import 'package:cotton_candy/notifier/user_notifier.dart';
import 'package:cotton_candy/screens/login_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:provider/provider.dart';

class LoginVerifier extends StatefulWidget {
  final Widget child;
  LoginVerifier(this.child);
  @override
  State<StatefulWidget> createState() {
    return _LoginVerifierState();
  }
}

class _LoginVerifierState extends State<LoginVerifier> {
  @override
  Widget build(BuildContext context) {
    UserNotifier userNotifier = context.watch();
    if (userNotifier.isLogin) {
      return widget.child;
    }
    return LoginScreen();
  }
}
